package cn.sstir.hackathon.core.page;

import cn.sgst.tool.common.page.IPage;
import cn.sgst.tool.common.page.Page;

/**
 * 最大返回页数为100页
 *
 *
 * @author: fli
 * @email: fli@sstir.cn
 * @date: 2019/12/27 13:49
 */
public class PageResult<T> extends Page<T> {



    public PageResult(long current, long size) {
        super(current, size);
    }

    public PageResult(long current, long size, long total) {
        super(current, size, total);
    }

    public PageResult() {
    }

    public PageResult(IPage page) {
        super.setCurrent(page.getCurrent());
        super.setSize(page.getSize());
        super.setTotal(page.getTotal());
        super.setPages(page.getPages());
        super.setRecords(page.getRecords());
    }


    @Override
    public long getPages() {
        long pages = super.getPages();
        return Math.min(pages,100);
    }
}
